import BaseItemView from "../../../cfw/mvc/BaseItemView";
import { ItemState } from "../../../cfw/tools/Define";
import BottleItemModel from "../model/BottleItemModel";
import BaseItemModel from "../../../cfw/mvc/BaseItemModel";


const { ccclass, property } = cc._decorator;

@ccclass
export default class BottleItemView extends BaseItemView {


    @property(cc.Sprite)
    ad: cc.Sprite = null;

    @property(cc.Node)
    point: cc.Node = null;


    protected model: BottleItemModel
    start() {
        this.updateState()
    }

    addListener() {
        this.eventProxy.on(BaseItemModel.UPDATE_STATE, this.updateState, this)
    }
    
    needBuy() {
        return this.model.needBuy()
    }


    updateState() {
        if (!cc.isValid(this.node) || !this.model) {
            return;
        }
        if (!this.model.needBuy()) {
            if (this.ad) {
                this.ad.node.active = false;
            }
        }
    }
    // update (dt) {}
}
